package com.yigerende.management.controller;

import com.yigerende.management.bean.CommonResult;
import com.yigerende.management.service.OrderDinService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(value = "订单管理",tags = {"订单管理接口","测试接口"})
@RestController
@RequestMapping("/test/Order")
@CrossOrigin//解决跨域
public class OrderController {

    @Autowired
    private OrderDinService orderDinService;

    /**
     * 下单
     * @param goodsId 商品ID
     * @param userId
     * @return
     */
    @GetMapping("/create/{id}")
    public CommonResult createOrder(@PathVariable("id") Long goodsId, @RequestHeader Long userId) {
        orderDinService.createPreOrder(goodsId,userId);
         return new CommonResult();

    }
}
